import java.util.Arrays;

public class TestDemo4 {
    public static void main(String[] args) {
        int[] nums = {2,7,11,15};
        int target = 9;
        int[] ret = func(nums, target);
        System.out.println(Arrays.toString(ret));
    }

    public static int[] func(int[] num, int target){
        int[] ret = new int[2];
        for(int i = 0; i < num.length; i++){
            for(int j = i + 1; j < num.length; j++){
                if(num[i] + num[j] == target){
                    ret[0] = i;
                    ret[1] = j;
                    return ret;
                }
            }
        }
        return null;
    }
}
